var _n27;
var cc__extends = __extends;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.sers = exports.mgrs = undefined;
var $1$TimePlugIn = require("TimePlugIn");
var a = cc__importDefault($1$TimePlugIn);
var $1$bundleManager = require("bundleManager");
var s = cc__importDefault($1$bundleManager);
var $1$gameManager = require("gameManager");
var c = cc__importDefault($1$gameManager);
var $1$soundManager = require("soundManager");
var l = cc__importDefault($1$soundManager);
var $1$localStorageService = require("localStorageService");
var u = cc__importDefault($1$localStorageService);
var $1$platformService = require("platformService");
var p = cc__importDefault($1$platformService);
var $1$uiService = require("uiService");
var d = cc__importDefault($1$uiService);
var $1$userService = require("userService");
var h = cc__importDefault($1$userService);
var f = function (t) {
  function e() {
    // 调用传入的构造函数并确保返回当前上下文
    var instance = t.call(this) || this;
    

    // 设置系统的基本属性
    instance._systemName = "主系统"; // 系统名称
    instance._managers = {};          // 管理器对象初始化为空
    instance._servers = {};           // 服务器对象初始化为空

    // 返回创建的系统实例
    return instance;
  }
  cc__extends(e, t);
  e.prototype.Initialize = function () {
    // 调用父类的初始化方法
    t.prototype.Initialize.call(this);
    console.log("初始化"); // 输出初始化日志

    // 初始化服务
    console.log("初始化服务");
    this._servers = {
      localStorageSrv: new u.default(), // 本地存储服务
      platformSrv: new p.default(),      // 平台服务
      userSrv: new h.default(),          // 用户服务
      uiSrv: new d.default()              // UI 服务
    };
    console.log("-----服务--初始化完毕-----"); // 服务初始化完成日志

    // 初始化管理类
    console.log("初始化管理类");
    this._managers = {
      gameMgr: new c.default(),    // 游戏管理器
      soundMgr: new l.default(),    // 音效管理器
      bundleMgr: undefined          // 资源包管理器（未定义）
    };
    console.log("-----管理--初始化完毕-----"); // 管理类初始化完成日志

    // 运行全局初始化函数
    a.default();

    // 初始化用户服务相关的功能
    this._servers.userSrv._initPower(); // 初始化用户权限
    this._servers.userSrv._initCoin();   // 初始化用户金币

  };
  e.prototype.Canvas = function () {
    return cc.find("Canvas");
  };
  e.prototype.Component = function () {
    return this.Canvas().getComponent(cc.Component);
  };
  e.prototype.InitBundle = function () {
    this._managers.bundleMgr = new s.default();
  };
  e.prototype.emit = function (t, e, o, n, i, r) {
    this.Canvas().emit(t, e, o, n, i, r);
  };
  e.prototype.on = function (t, e, o, n) {
    this.Canvas().on(t, e, o, n);
  };
  e.prototype.once = function (t, e, o, n) {
    this.Canvas().once(t, e, o, n);
  };
  e.prototype.off = function (t, e, o, n) {
    this.Canvas().off(t, e, o, n);
  };
  e.prototype.loadScene = function (t) {
    console.log("正在加载场景:", t);
    return new Promise(function (e) {
      cc.director.loadScene(t, e);
    });
  };
  Object.defineProperty(e.prototype, "Managers", {
    get() {
      return this._managers;
    },
    enumerable: false,
    configurable: true
  });
  Object.defineProperty(e.prototype, "Servers", {
    get() {
      return this._servers;
    },
    enumerable: false,
    configurable: true
  });
  return e;
}(cc__importDefault(require("systemBase")).default);
exports.mgrs = function () {
  return def_OverallSystem.Managers;
};
exports.sers = function () {
  return def_OverallSystem.Servers;
};
var def_OverallSystem = function () {
  try {
    return new f();
  } catch (t) {
    console.error("主系统创建失败 :", t);
    return null;
  }
}();
exports.default = def_OverallSystem;